package org.example.service;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
public class AsyncService {


    @Async
    public void performAsyncTask() {
        try {
            // 模拟耗时操作
            Thread.sleep(5000);
            System.out.println("异步任务完成");
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            System.err.println("异步任务被中断: " + e.getMessage());
        }
    }
}
